home *** CD-ROM | disk | FTP | other *** search
- /* -*-c-*- */
-
- /* Copyright (C) 1989, 1992 Free Software Foundation, Inc.
-
- This file is part of GNU CC.
-
- GNU CC is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- GNU CC is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with GNU CC; see the file COPYING. If not, write to
- the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
- /* As a special exception, if you link this library with files
- compiled with GCC to produce an executable, this does not cause
- the resulting executable to be covered by the GNU General Public License.
- This exception does not however invalidate any other reasons why
- the executable file might be covered by the GNU General Public License. */
-
- /*
- $Header: /usr/user/dennis_glatting/ObjC/c-runtime/include/RCS/objc-protoP.h,v 1.1 1992/04/13 11:40:53 dennisg Exp dennisg $
- $Author: dennisg $
- $Date: 1992/04/13 11:40:53 $
- $Log: objc-protoP.h,v $
- * Revision 1.1 1992/04/13 11:40:53 dennisg
- * Initial revision
- *
- * Revision 0.11 1991/12/31 20:16:08 dennisg
- * Deleted index variable stuff. Index variables are a hack to the language.
- * Cleaned up some documentation.
- *
- * Revision 0.10 1991/12/10 12:03:22 dennisg
- * Cleaned up file format for a distribution.
- *
- * Revision 0.9 1991/12/01 01:29:29 dennisg
- * modified to remove changes previously made to
- * implement posing. posing just got easy.
- *
- * Revision 0.8 1991/11/29 22:00:10 dennisg
- * modified to implement set functions.
- *
- * Revision 0.7 1991/11/29 20:02:01 dennisg
- * fixed several const decls. bozo.
- *
- * Revision 0.6 1991/11/29 13:32:16 dennisg
- * committed some functions to inline and changes prototypes
- * to match.
- * also added some documentation.
- *
- * Revision 0.5 1991/11/29 00:24:14 dennisg
- * many changes including posing, things to make the compiler
- * happier, structure changes, and things to make it play better.
- *
- * Revision 0.4 1991/11/19 12:37:49 dennisg
- * modified to support changes of run-time.
- *
- * Revision 0.3 1991/11/16 15:56:07 dennisg
- * deleted some prototypes that are no longer part of the
- * implementation.
- * added others.
- *
- * Revision 0.2 1991/11/07 22:31:42 dennisg
- * added copyleft.
- *
- * Revision 0.1 1991/10/24 00:19:24 dennisg
- * Initial check in. Preliminary development stage.
- *
- */
-
-
- #ifndef _objc_protop_INCLUDE_GNU
- #define _objc_protop_INCLUDE_GNU
-
- #include <stdio.h>
-
- #include <tm.h>
-
- #include <objc.h>
-
-
- /*
- * Add a class to the class hash table and assign it a class number.
- */
- void
- addClassToHash(Class_t aClass);
-
- /*
- * This function takes a list of methods and adds them to the method list of
- * a class. The method list must remain intact during the lifetime of the
- * class.
- */
- void
- addMethodsToClass (Class_t, MethodList_t);
-
- /*
- * This function creates a new instance of aClass, initializes its isa
- * instance variable to point to the class, and return the new instance.
- *
- * All other instance variables are initialized to 0.
- */
- static inline id
- class_createInstance( Class_t aClass) {
-
- return (*_alloc)(aClass);
- }
-
- /*
- * object_dispose() frees the memory occupied by aObject after setting its
- * isa instance variable to nil, and returns nil. The function it calls to
- * do this work can be changed by reassigning the _dealloc variable.
- */
- static inline id
- object_dispose (id aObject) {
-
- return (*_dealloc)(aObject);
- }
-
- /*
- * object_copy() creates a new object that's an exact copy of anObject and
- * return the new object. The second argument, indexedIvarBytes, specifies
- * the number of additional bytes that should be allocated for the copy to
- * accommodate indexed instance variables; it serves the same purpose as the
- * second argument to class_createInstance(). The function that
- * object_copy() calls to do this work can be changed by reassigning the
- * _copy variable.
- */
- static inline id
- object_copy (id aObject) {
-
- return (*_copy)(aObject);
- }
-
- /*
- * object_realloc() reallocates storage for anObject, adding numBytes if
- * possible. The memory previously occupied by anObject is freed if it can't
- * be reused, and a pointer to the new location of anObject is returned. The
- * function that object_realloc() calls to do this work can be changed by
- * reassigning the _realloc variable.
- */
- static inline id
- object_realloc (id aObject, u_int numBytes) {
-
- return (*_realloc)(aObject, numBytes);
- }
-
- /*
- * This function causes one class to pose as its super class. Messages sent
- * to the super class will actually be sent to the posing class.
- *
- * Instance variables should not be declared in the posing class. The posing
- * class can add new methods to the class or override existing methods in the
- * super class.
- */
- Class_t
- class_poseAs(Class_t, Class_t);
-
-
- /* These functions set and return the class version number. */
- static inline void
- class_setVersion(Class_t aClass, long theVersion) {
-
- aClass->version = theVersion ;
- aClass->isa->version = theVersion ;
- }
-
- static inline long
- class_getVersion(Class_t aClass) {
-
- return aClass->version ;
- }
-
-
- /*
- * Class numbers are stored in the class's info variable. This is temporary.
- * Eventually we will allocate a member to the class so that some efficiency
- * can be gained by not shifting.
- */
- #define CLASS_LOCATION_SHIFT (BITS_PER_WORD / 2)
-
- static inline void
- setClassNumber (Class_t aClass, u_int aNumber) {
-
-
- aClass->info |= aNumber << CLASS_LOCATION_SHIFT;
- }
-
- static inline u_int
- getClassNumber (Class_t aClass) {
-
-
- return aClass->info >> CLASS_LOCATION_SHIFT;
- }
-
-
- /*
- * These functions add and remove methods in a list from a class. These
- * functions perform the actual work required for those functions.
- *
- * The appropriate run-time is to provide the user callable functions to
- * perform these functions. Typically those functions perform something
- * specific to their run-time type and call these functions to perform the
- * actual work.
- */
- void
- class_removeMethods (Class_t aClass, MethodList_t aMethodList);
-
- /*
- * Find the named method in a linked list of methods.
- */
- Method_t
- searchForMethodInList (MethodList_t aList, const char* selName);
-
- /*
- * fprintf() is used id we're debugging. If DEBUG isn't defined then this
- * def isn't defined thereby causing the compiler to eliminate the parameter
- * decl.
- */
- #ifdef DEBUG
- #define DEBUG_PRINTF fprintf
- #else
- #define DEBUG_PRINTF
- #endif
-
-
- /*
- * Function that dumps information about all of the classes to stdout.
- */
- void
- debug_dump_classes(void);
-
- #endif
-
-